<?php

class Pdd
{
    public $data = [];
    private $union;

    //数据库返回的存在数据
    // 0	默认 1	待支付 2	已支付 3	已退款 4	已完成 5	已失效 6	已结算 11	已取消
    //订单状态：0-已支付；1-已成团；2-确认收货；3-审核成功；4-审核失败（不可提现）；5-已经结算 ;10-已处罚
    public $status = [
        '0' => 2,
        '1' => 2,
        '2' => 2,
        '3' => 2,
        '4' => 11,
        '5' => 6,
        '10' => 11
    ];

    public function __construct($union)
    {
        $this->union = $union;
    }


    //公共查询
    public function public_query($params = [], $code = '')
    {
        $url = "http://gw-api.pinduoduo.com/api/router";
        $secret = $this->union['appSecret'];
        $client_id = $this->union['clientId'];
        $p1 = ['timestamp' => time(),
            'data_type' => 'JSON',
            'client_id' => $client_id
        ];
        $params = array_merge($p1, $params);
        $params['sign'] = $this->sign($params, $secret);
        $headers = array('Content-Type:application/x-www-form-urlencoded;charset=utf-8');
        $curl = curl_init(); // 启动一个CURL会话
        curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
        curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
        curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
        curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
        curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params)); // Post提交的数据包
        curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环
        curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
        $result = curl_exec($curl); // 执行操作
        if (curl_errno($curl)) {
            return ['code' => false, 'msg' => 'Errno' . curl_error($curl)];
        }
        curl_close($curl); // 关闭CURL会话
        $res = json_decode($result, true);
        if (array_key_exists('error_response', $res)) {
            if (empty($code)) {
                if (strstr($_SERVER['REQUEST_URI'], 'order_list') || strstr($_SERVER['REQUEST_URI'], 'footprint') || strstr($_SERVER['REQUEST_URI'], 'collect_list')) {
                    return ['code' => false, 'msg' => "未获取数据"];
                }
                header('Content-Type:application/json');
                $data['msg'] = $res['error_response']['error_msg'] . '-' . $res['error_response']['sub_msg'];
                return ['code' => false, 'msg' => $data['msg']];
            }
            if ($code == 1) {
                return ['code' => false, 'msg' => $res['error_response']['error_msg'] . '-' . $res['error_response']['sub_msg']];
            }
            return $res;
        }
        return $res;

    }

    //签名方法
    protected function sign(array $params, $secret)
    {
        ksort($params);
        $str = '';
        foreach ($params as $name => $value) {
            $str .= "{$name}{$value}";
        }
        return strtoupper(md5(implode('', [$secret, $str, $secret])));
    }

    //公共列表转换
    public function trun_list($res, $code = 0)
    {
        $data = [];
        $site = "pdd";
        foreach ($res as $k => $v) {
            $arr = [
                "GoodsId" => $v['goods_sign'],
                "Title" => $v['goods_name'],
                "ShortTitle" => $v['goods_name'],
                "ShopType" => '拼多多',
                "PicLogo" => $v['goods_thumbnail_url'],//$v['goods_image_url'],
                'Suggest' => $v['goods_desc'],
                "CouponMoney" => $v['has_coupon'] ? $v['coupon_discount'] / 100 : 0,
                "CouponSurplus" => $v['mall_coupon_remain_quantity'],
                "Price" => $v['min_group_price'] / 100,
                "EndPrice" => ($v['min_group_price'] - $v['coupon_discount']) / 100,
                "Commission" => ($v['min_group_price'] - $v['coupon_discount']) / 100 * $v['promotion_rate'] / 1000,
                "MonthSale" => $v['sales_tip'],
                'VideoUrl' => '',
                "Site" => $site,
                "ShopName" => $v['mall_name'],
                "Couponurl" => "",
            ];
            //详情
            if ($code == 1) {
                $a1 = ['PicList' => $v['goods_gallery_urls'],
                    'SmallImages' => $v['goods_gallery_urls'],
                    "ShopName" => $v['mall_name'],
                    "ShopId" => $v['mall_id'],
                    "ShopUrl" => '',
                    "ShopIcon" => '',
                    'Couponurl' => '',
                    'CouponStartTime' => date('Y-m-d', $v['coupon_start_time']),
                    'CouponEndTime' => date('Y-m-d', $v['coupon_end_time']),
                    "DescTxt" => sprintf("%.2f", round(4.9, 2)),
                    "ServTxt" => sprintf("%.2f", round(4.9, 2)),
                    "AvgTxt" => sprintf("%.2f", round(4.9, 2)),
                ];
                $arr = array_merge($arr, $a1);
            }
            $data[] = $arr;
        }
        return $data;
    }

    //分类
    public function categroy()
    {
        $params = [
            'parent_opt_id' => 0,
            'type' => 'pdd.goods.opt.get'];
        $res = $this->public_query($params);
        $data = [];
        foreach ($res['goods_opt_get_response']['goods_opt_list'] as $k => $v) {
            if ($k < 30) {
                $data[] = [
                    'name' => $v['opt_name'],
                    'category_id' => "{$v['opt_id']}",
                    'site' => 'pdd',
                    'image'=>''
                ];
            }
        }
        $data = $this->assoc_unique($data, 'name');
        return $data;
    }

    //数组去重

    public function assoc_unique($arr, $key)
    {
        $tmp_arr = array();
        foreach ($arr as $k => $v) {
            if (in_array($v[$key], $tmp_arr)) {//搜索$v[$key]是否在$tmp_arr数组中存在，若存在返回true
                unset($arr[$k]);
            } else {
                $tmp_arr[] = $v[$key];
            }
        }
        return $arr;
    }


    /**
     * @func获取拼多多的转链
     */
    public function pdd_turn($goods_id, $pid)
    {
        $xcx_params = [
            'goods_sign_list' => "['$goods_id']",
            'generate_short_url' => "true",
//            'generate_authority_url' => "true",
            'p_id' => $pid,
            'generate_we_app' => 'true',
            'type' => 'pdd.ddk.goods.promotion.url.generate'//config('api.pin_duo_duo.product.promotion_url'),
        ];
        $response = $this->public_query($xcx_params);
        if (isset($response['error_response'])) {
            return ['status' => false, 'msg' => $response['error_response']['error_msg']];
        } else {
            $data = $response['goods_promotion_url_generate_response']['goods_promotion_url_list'][0];
            $data['page_path'] = $data['we_app_info']['page_path'];
            $data['long_url'] = $data['url'];
            $data['app_url'] = str_replace("https://mobile.yangkeduo.com", "pinduoduo://com.xunmeng.pinduoduo", $data['url']);
            $data['url'] = str_replace("https://mobile.yangkeduo.com", "pinduoduo://com.xunmeng.pinduoduo", $data['url']);
            return ['status' => true, 'msg' => '获取成功', 'data' => $data];//拼多多的所有链接
        }
    }


    //商品列表
    public function goods_list($params)
    {
        $h_params = [];
        if ($params['category_id']) {
            $h_params['opt_id'] = $params['category_id'];
        };
        if ($params['page_size']) {
            $h_params['page_size'] = $params['page_size'];
        } else {
            $h_params['page_size'] = 10;
        }
        if ($params['page']) {
            $h_params['page'] = $params['page'];
        }
        if ($params['order_by']) {
            if ($params['order_by'] == 'price' && $params['sort'] == 'asc') {
                $h_params['sort_type'] = 3;
            }
            if ($params['order_by'] == 'price' && $params['sort'] == 'desc') {
                $h_params['sort_type'] = 4;
            }
            if ($params['order_by'] == 'sale' && $params['sort'] == 'asc') {
                $h_params['sort_type'] = 0;
            }
        };
        if ($params['is_compoon']) {
            $h_params['with_coupon'] = 'true';
        } else {
            $h_params['with_coupon'] = 'false';
        }
        $h_params['type'] = 'pdd.ddk.goods.search';
        $res = $this->public_query($h_params);
        if(isset($res['code'])){
            return ['status'=>false,'msg'=>$res['msg'],'data'=>[]];
        }
        $responseResult['status'] = true;
        $responseResult['msg'] = "获取成功";
        $responseResult['data'] = $this->trun_list($res['goods_search_response']['goods_list']);
        return $responseResult;

    }

    //商品详情
    public function goods_detail($goods_id,$pid='')
    {
        //$params['goods_id_list']="[{$goods_id}]";
        $params['goods_sign'] = "{$goods_id}";
        $params['p_id'] = '1021632_107480953';
        $params['type'] = 'pdd.ddk.goods.detail';
        $res = $this->public_query($params);
        if(isset($res['code']) && !$res['code']){
            return ['status'=>false,'msg'=>$res['msg']];
        }
        $res = $this->trun_list($res['goods_detail_response']['goods_details'], 1);
        return ['status'=>true,'msg'=>'获取成功','data'=>$res[0]];
    }

    public function goods_search($params)
    {
        $h_params = [];
        if ($params['keyword']) {
            $h_params['keyword'] = $params['keyword'];
        };

        if ($params['page_size']) {
            $h_params['page_size'] = $params['page_size'];
        } else {
            $h_params['page_size'] = 10;
        }
        if ($params['page']) {
            $h_params['page'] = $params['page'];
        }

        if ($params['order_by']) {
            if ($params['order_by'] == 'price' && $params['sort'] == 'asc') {
                $h_params['sort_type'] = 3;
            }
            if ($params['order_by'] == 'price' && $params['sort'] == 'desc') {
                $h_params['sort_type'] = 4;
            }
            if ($params['order_by'] == 'sale' && $params['sort'] == 'desc') {
                $h_params['sort_type'] = 6;
            }
            if ($params['order_by'] == 'sale' && $params['sort'] == 'asc') {
                $h_params['sort_type'] = 5;
            }
            if ($params['order_by'] == 'commission' && $params['sort'] == 'desc') {
                $h_params['sort_type'] = 14;
            }
            if ($params['order_by'] == 'commission' && $params['sort'] == 'asc') {
                $h_params['sort_type'] = 13;
            }
        };

        if ($params['pid']) {
            $h_params['pid'] = $params['pid'];
            $h_params['custom_parameters'] = json_encode(['uid' => $params['user_id']]);
        }

        if ($params['range_list']) {
            $h_params['range_list'] = '[{"range_id":1,"range_from":100,"range_to":990}]';
        }

        if ($params['cid']) {
            $h_params['opt_id'] = $params['cid'];
        }

        if ($params['coupon']) {              //是否有优惠卷
            $h_params['with_coupon'] = 'true';
        } else {
            $h_params['with_coupon'] = 'false';
        }
        $h_params['type'] = 'pdd.ddk.goods.search';
        $res = $this->public_query($h_params);
        $responseReturn = ['status'=>false,'msg'=>'获取失败','data'=>[]];
        if(isset($res['goods_search_response']['goods_list'])){
            $responseReturn['data'] = $this->trun_list($res['goods_search_response']['goods_list']);
            $responseReturn['status'] = true;
        }else{
            $responseReturn['msg'] = $res['msg'];
        }
        return $responseReturn;
    }

    /*
     * 生成多多进宝频道推广
     * 频道来源：4-限时秒杀,39997-充值中心, 39998-转链type，39999-电器城，39996-百亿补贴
     */
    public function site_turn($pid, $id = "", $acvity_source = "")
    {
        $params['pid'] = $pid;
        if (isset($id) && !empty($id)) {
            $params['resource_type'] = $id;
        } elseif (isset($acvity_source) && !empty($acvity_source)) {
            $params['url'] = $acvity_source;
        } else {
            return ['code' => false, 'msg' => '请传入需要转链的类型'];
        }
        $params['type'] = 'pdd.ddk.resource.url.gen';
        $res = $this->public_query($params);
        if (isset($res['code']) && !$res['code']) {
            return ['status' => false, 'data' => $res['msg']];
        } else {
            $resource_url_response = $res['resource_url_response']['single_url_list'];
            $responseMsg['url'] = $resource_url_response['url'];
            $responseMsg['short_url'] = $resource_url_response['mobile_short_url'];
            $responseMsg['page_path'] = $resource_url_response['we_app_web_view_short_url'];
            $responseMsg['app_url'] = str_replace("https://mobile.yangkeduo.com", "pinduoduo://com.xunmeng.pinduoduo", $resource_url_response['we_app_web_view_url']);
            $responseMsg['wx_code'] = "";
            return ['status' => true, 'msg' => '获取成功', 'data' => $responseMsg];
        }
    }


    /**
     * @param $uid
     * @param $pid
     * @return bool
     */
    public function unitUrlGen($url, $uid, $pid)
    {
        $h_params['type'] = 'pdd.ddk.resource.url.gen';
        $h_params['resource_type'] = 39998;
        $h_params['url'] = $url;
//        $h_params['custom_parameters'] = json_encode(['uid' => $uid]);
        $h_params['pid'] = $pid;


        $res = $this->public_query($h_params);

        $data['status'] = false;
        $data['short_url'] = "";
        if (isset($res['resource_url_response']['single_url_list']['short_url'])) {
            $data['status'] = true;
            $data['short_url'] = $res['resource_url_response']['single_url_list']['short_url'];
        }
        return $data;
    }


    /**
     * 专题转链接
     */
    public function site_generate($pid, $data = [])
    {
        $params['pid'] = $pid;
        if (isset($data['theme_ids']) && !empty($data['theme_ids'])) {
            $params['theme_id_list'] = "[{$data['theme_ids']}]";
        } else {
            return ['code' => false, 'msg' => '请传入需要转链的类型'];
        }
        $params['type'] = 'pdd.ddk.theme.prom.url.generate';
        $res = $this->public_query($params);
        if (isset($res['theme_promotion_url_generate_response'])) {
            if (isset($res['theme_promotion_url_generate_response']['url_list']) && !empty($res['theme_promotion_url_generate_response']['url_list'])) {
                return ['code' => true, 'data' => $res['theme_promotion_url_generate_response']['url_list'][0]];
            } else {
                return ['code' => false, 'msg' => '主题不存在或者已经下架'];
            }
        } else {
            return ['code' => false, 'msg' => '主题不存在或者已经下架'];
        }

    }


    /**
     * 专题转链接
     */
    public function theme_list_get($data = [])
    {
        $data['page'] = 1;
        $data['page_size'] = 10;
        $params['type'] = 'pdd.ddk.theme.list.get';
        $res = $this->public_query($params);
        return $res;
    }

    /**
     * 创建拼多多推广位
     * @param $phone
     * @return array
     */
    public function Createppdid($phone)
    {
        $phone = $phone . rand(1, 100);
        $h_params['type'] = 'pdd.ddk.goods.pid.generate';
        $h_params['number'] = 1;
        //$h_params['p_id_name_list'] = "[".$phone."]";
        $h_params['media_id'] = $this->union['mediaId'];
        $res = $this->public_query($h_params, 1);
        if (isset($res['code'])) {
            return ['status' => false, 'msg' => '推广位创建失败'];
        } else {
            $responseMsg['pid'] = $res['p_id_generate_response']['p_id_list'][0]['p_id'];
            return ['status' => true, 'msg' => '推广位创建成功', 'data' => $responseMsg];
        }
    }


    /**
     * 运营频道商品查询API
     */
    public function recommendget($params)
    {
        $h_params['type'] = 'pdd.ddk.goods.recommend.get';
        $h_params['offset'] = $params['page'] * $params['page_size'];
        $h_params['limit'] = $params['page_size'];
        $h_params['channel_type'] = $params['type'];
        $res = $this->public_query($h_params, 1);
        if (isset($res['goods_basic_detail_response'])) {
            $res = $this->trun_list($res['goods_basic_detail_response']['list']);
        }
        return $res;
    }


    /**
     * 订单参数转换
     */
    private function returnOrderDeal($data)
    {
        $responseTurnData = [];
        foreach ($data as $k => $v) {
            $turnData = [
                'orderId' => $v['order_sn'],
                'site' =>'pdd',
                'orderStatus' => $this->status[$v['order_status']],
                'orderSrc' => 3,
                'tag' => '拼多多',
                'tagItem' => '拼多多',
                'name' => $v['goods_name'],
                'goodsId' => $v['goods_sign'],
                'images' => $v['goods_thumbnail_url'],
                'rid' => isset($v['p_id']) ? $v['p_id'] : 0,
                'shopName' => $v['mall_name'],
                'price' => $v['goods_price'] / 100,
                'orderType' => in_array($this->status[$v['order_status']],[2,6]) ? 1 : 4,
                'payMoney' => isset($v['order_amount']) ? $v['order_amount'] / 100 : 0,
                'rebateAmount' => $v['promotion_amount'] / 100,
                'incomeRate' => $v['promotion_rate'] * 10,
                'orderCreateTime' => date("Y-m-d H:i:s", $v['order_create_time']),
                'orderPaidTime' => isset($v['order_pay_time']) ? date("Y-m-d H:i:s", $v['order_pay_time']) : null,
                'orderEarningTime' => isset($v['order_receive_time']) ? date("Y-m-d H:i:s", $v['order_receive_time']) : null,
                'settleTime' => isset($v['order_settle_time']) ? date("Y-m-d H:i:s", $v['order_settle_time'] / 1000) : null,
                'isPunish' => ($v['order_status'] == 10) ? true : false,
            ];
            $responseTurnData[] = $turnData;
        }
        return $responseTurnData;
    }


    /**
     * 拼多多订单
     * https://jinbao.pinduoduo.com/third-party/api-detail?apiName=pdd.ddk.order.list.range.get
     */
    public function getOrder($start_time, $end_time, $page = 1, &$responseMsgDataResult = [])
    {
//        $start_time = "2022-07-20 16:30:00";
//        $end_time = "2022-07-20 16:35:00";
        $params['type'] = 'pdd.ddk.order.list.range.get';
        $params['start_time'] = $start_time;
        $params['page_size'] = 300;
        $params['end_time'] = $end_time;
        if($page != 1){
            $params['last_order_id'] = $page;
        }
        $responseMsg = $this->public_query($params);
        if (isset($responseMsg['order_list_get_response'])) {
            $responseMsgData = $responseMsg['order_list_get_response'];
            if ($responseMsgData['order_list'] != []) {
                if(empty($responseMsgDataResult)){
                    $responseMsgDataResult = $responseMsgData['order_list'];
                }else{
                    $responseMsgDataResult = array_merge($responseMsgDataResult, $responseMsgData['order_list']);
                }
                if (isset($responseMsgData['last_order_id'])) {
                    $this->getOrder($start_time, $end_time, $responseMsgData['last_order_id'], $responseMsgDataResult);
                }
            }
        }
        return $this->returnOrderDeal($responseMsgDataResult);
    }


    /**
     * 拼多多查询用户是否备案
     */
    public function member_authority($uid, $pid)
    {
        $h_params['type'] = 'pdd.ddk.member.authority.query';
        $h_params['channel_type'] = 10;
        $h_params['custom_parameters'] = json_encode(['uid' => $uid]);
        $h_params['pid'] = $pid;
        $res = $this->public_query($h_params);
        if (isset($res['authority_query_response']['bind']) && $res['authority_query_response']['bind'] == 1) {
            return true;
        }
        return false;
    }


    /**
     * 拼多多绑定备案
     */
    public function rp_prom($uid,$pid)
    {
        $h_params['type'] = 'pdd.ddk.rp.prom.url.generate';
        $h_params['channel_type'] = 10;
        $h_params['custom_parameters'] = json_encode(['uid' => $uid]);
        $h_params['p_id_list'] = "['$pid']";
        $res = $this->public_query($h_params);
        $responseReturn = ['status'=>false,'msg'=>'获取失败','data'=>[]];
        if (isset($res['rp_promotion_url_generate_response']['url_list'][0]['mobile_url'])) {
            $rp_promotion_url_generate_response = $res['rp_promotion_url_generate_response']['url_list'][0]['mobile_url'];
            $app_rp_promotion_url_generate_response = str_replace("https://mobile.yangkeduo.com", "pinduoduo://com.xunmeng.pinduoduo", $rp_promotion_url_generate_response);
            $result['h5url'] = $rp_promotion_url_generate_response;
            $result['appurl'] = $app_rp_promotion_url_generate_response;
            $responseReturn['status'] = true;
            $responseReturn['data'] = $result;
        }else{
            $responseReturn['status'] = false;
            $responseReturn['msg'] = isset($res['msg']) ? $res['msg'] : '获取失败';
        }
        return $responseReturn;
    }


    //好京客 通过商品的goods_id搜索goods_sign
    //http://www.haojingke.com/index.php/open-api
    public function haojingke_goods($params = [], $code = '')
    {
        $url = "https://api-gw.haojingke.com/index.php/v1/api/pdd/goodslist";
        $params['apikey'] = '0744552cce43e850';
        $headers = array('Content-Type:application/x-www-form-urlencoded;charset=utf-8');
        $curl = curl_init(); // 启动一个CURL会话
        curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
        curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
        curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
        curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
        curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
        curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params)); // Post提交的数据包
        curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循环
        curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
        $result = curl_exec($curl); // 执行操作
        if (curl_errno($curl)) {
            echo 'Errno' . curl_error($curl);//捕抓异常
        }
        curl_close($curl); // 关闭CURL会话
        $res = json_decode($result, true);
        if (isset($res['data']['goods_list'][0])) {
            $res = $res['data']['goods_list'][0];
            return $res;
        }
        return [];
    }



    //好京客 通过商品的goods_id搜索goods_sign
    //http://www.haojingke.com/index.php/open-api
    public function haojingkeGoods($goodsId)
    {
        $params['apikey'] = '4424ee9bb4a958ed';
        $params['isunion'] = 1;
        $params['keyword'] = (int)$goodsId;
        $url = "https://api-gw.haojingke.com/index.php/v1/api/pdd/goodslist?" . http_build_query($params);
        $responseMsg = \Common\Common::request_get($url);
        if (isset($responseMsg['data']['goods_list'][0]['goods_sign'])) {
            return ['status' => true, 'goodsId' => $responseMsg['data']['goods_list'][0]['goods_sign'], 'msg' => '解析成功'];
        } else {
            return ['status' => false, 'goodsId' => '', 'msg' => '解析失败'];
        }
    }


    //好京客 通过商品的goods_id搜索goods_sign
    //http://www.haojingke.com/index.php/open-api
    public function haojingkeDetails($goodsId){
        $params['apikey'] = '4424ee9bb4a958ed';
        $params['isunion'] = 1;
        $params['goods_id'] = (int)$goodsId;
        $url = "https://api-gw.haojingke.com/index.php/v1/api/pdd/goodslist?" . http_build_query($params);
        $responseMsg =  \Common\Common::request_get($url);
        if (isset($responseMsg['data']['goods_list'][0]['goods_sign'])) {
            return ['status' => true, 'goodsId' => $responseMsg['data']['goods_list'][0]['goods_sign'], 'msg' => '解析成功'];
        } else {
            return ['status' => false, 'goodsId' => '', 'msg' => '解析失败'];
        }
    }




}
